# api/v1/health.py
from fastapi import APIRouter
from db.session import engine
from sqlalchemy import text

router = APIRouter()

@router.get("/")
def health_check():
    try:
        with engine.connect() as conn:
            conn.execute(text("SELECT 1"))
        return {"status": "healthy", "database": "connected"}
    except Exception as e:
        return {"status": "unhealthy", "error": str(e)}